The bug found in the presentation that we forgot to review has been fixed
[RRRRHHHH_Code] / ruralHouses client / src / gui / ModifyHouseGUI.java
index 3377c69..1e6b2ce 100644 (file)
@@ -6,6 +6,7 @@ import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.rmi.Naming;
 import java.rmi.RemoteException;
+import java.util.Vector;
 
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.JButton;
@@ -147,20 +148,31 @@ public class ModifyHouseGUI extends JFrame {
                
                                try {
                                        if (hm.registerNewHouse(newRh)) {
-                                               owner.getRuralHouses().add(newRh);
-                                               houseBox.removeItem(rh);
                                                feedback.setText("House properly modified");
                                        } else
                                                feedback.setText("Imposible to modify the house");
                                } catch (RemoteException e) {
-                                       // TODO Auto-generated catch block
                                        e.printStackTrace();
                                }
 
                        }
                });
-
-               houseBox = new JComboBox<RuralHouse>(o.getRuralHouses());
+               HouseInterface hm= null;
+               try {
+                       hm = (HouseInterface) Naming
+                                       .lookup(___IntNames.HouseManager);
+               } catch (Exception e1) {
+                       System.out.println("Error accessing remote authentication: "
+                                       + e1.toString());
+               }
+               Vector<RuralHouse> list = null;
+               try {
+                       list = hm.getHouses(o, null, null, 0, 0, 0, 0, 0);
+               } catch (RemoteException e1) {
+                       e1.printStackTrace();
+               }
+               
+               houseBox = new JComboBox<RuralHouse>(list);
                if (!o.getRuralHouses().isEmpty()) {
                        rh = (RuralHouse) houseBox.getSelectedItem();                   
                        comboBox.setSelectedItem(rh.getDistrict());